﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Collections.Specialized;
using System.Text;

public partial class SLForMap : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //读取webservice地址
        //设置response没有缓存
        Response.Cache.SetCacheability(HttpCacheability.NoCache);

        //将读取到的配置设置到初始化参数上，以传递给silverlight
        SaveSilverlightDeploymentSettings(ParamInitParams);

    }

    private void SaveSilverlightDeploymentSettings(Literal litSettings)
    {
        NameValueCollection appSettings = ConfigurationManager.AppSettings;

        StringBuilder sb = new StringBuilder();
        sb.Append("<param name=\"InitParams\" value=\"");

        int SettingCount = appSettings.Count;
        for (int Idex = 0; Idex < SettingCount; Idex++)
        {
            sb.Append(appSettings.GetKey(Idex));
            sb.Append("=");
            sb.Append(appSettings[Idex]);
            sb.Append(",");

        }
        sb.Append("\" />");
        litSettings.Text = sb.ToString();
    }
}